package com.qf.spring2202.aop.advice;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

public class MyAroundAdvice implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        //1.前置逻辑
        long start = System.currentTimeMillis();

        //2.调用原始对象的方法
        Object result = invocation.proceed();

        //3.后置逻辑
        long end = System.currentTimeMillis();

        System.out.println("times used = "+(end-start));

        return result;
    }
}
